//
//  HCWeakObject.m
//  HCToolBox
//
//  Created by Hotacool on 2019/4/9.
//

#import "HCWeakObject.h"

@interface HCWeakObject ()
@property (nonatomic, weak, readwrite) NSObject *target;

@end

@implementation HCWeakObject
+ (instancetype)weakObjectWithTarget:(NSObject *)target {
    HCWeakObject *weakObject = [[HCWeakObject alloc] init];
    weakObject.target = target;
    return weakObject;
}

- (id)forwardingTargetForSelector:(SEL)aSelector {
    if (self.target&&[self.target respondsToSelector:aSelector]) {
        return self.target;
    }
    return nil;
}
@end
